package com.ymk.service.impl;

import com.alibaba.fastjson.JSON;
import com.ymk.base.mybatis.DaoRouter;
import com.ymk.base.mybatis.Pagination;
import com.ymk.bo.goods.GoodsBO;
import com.ymk.core.constants.SysConstants;
import com.ymk.service.IGoodsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author 莫参商
 * @since 2023-05-05
 */
@Service
public class GoodsService implements IGoodsService {

    @Override
    public GoodsBO get(Map param) {
        return this.daoRouter.queryForObject("Goods.loadGoods", param);
    }

    @Override
    public List<GoodsBO> list(Map param) {
        return this.daoRouter.query("Goods.loadGoods", param);
    }

    @Override
    public List<GoodsBO> listForPage(Pagination pagination) {
        return this.daoRouter.query("Goods.loadGoodsForPage", pagination);
    }

    @Override
    public void post(GoodsBO param) {
        this.daoRouter.insert("AGoods.insertGoods", param);
    }

    @Override
    public void update(GoodsBO param) {
        this.daoRouter.update("AGoods.updateGoods", param);
    }

    @Override
    public void del(GoodsBO param) {
        this.daoRouter.update("AGoods.delGoods", param);
    }

    @Autowired
    private DaoRouter daoRouter;
    @Autowired
    private RedisTemplate<String, String> redisTemplate;

}
